package com.qyer.util.log.util;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.qyer.util.log.entity.City;
import com.qyer.util.log.entity.Country;
import com.qyer.util.log.entity.Guide;


/**
 * @author matrix
 */
public class AppUgcUtil{

    /**
     * 城市与折扣ID与名称的对应关系
     */
//    private static String cityCSV = "/usr/local/cloud/src/plugins/data/city_list.csv";
//	private static String guideCSV = "/usr/local/cloud/src/plugins/data/guide_list.csv";
//	private static String app_Path="/usr/local/cloud/src/plugins/data/app_trans.xml";

//    private static String cityCSV = "/Users/wangzhen/qyer/city_list.csv";
//    private static String guideCSV = "/Users/wangzhen/qyer/guide_list.csv";
//    private static String app_Path="/Users/wangzhen/qyer/git/qyer/matrix-hive/src/main/java/app_trans.xml";
//    private static Map<String,String> mapApp = new HashMap<String,String>();// 存储app规则

//    static class City {
//        String cityid;
//        String cityname;
//        Country country;
//    }
//    static class Country {
//        String countryid;
//        String countryname;
//    }
//    static class Guide {
//        String id;
//        String name;
//    }

    //private Map<String, String> argsMap;
    private String argsStr;
//    private static Map<String, City> cityMap = new HashMap<String, City>();
//    private static Map<String, Country> countryMap = new HashMap<String, Country>();


    /**
     * 针对参数中传递的cityid和countryid、guideid异常进行相应处理
     * @param type
     * @return
     */
    public String getNameByType(String type , Map<String ,City> cityMap ,  Map<String ,Country> countryMap ,  Map<String ,Guide> guideMap) {
        if (type.equals("CITY")) {
            String id = findArgs("city_id");
            if (id.equals("-")) {
                id = findArgs("cityid");
            }
            if (id == null || id.equals("-")) {
                return "-";
            }
            City city = cityMap.get(id);
            if (city != null) {
                return city.getCityname();
            }
            return id;
        } else if (type.equals("COUNTRY")){
            String id = findArgs("countryid");
            if (id.equals("-")) {
                id = findArgs("country_id");
            }
            if (id.equals("-")) {
                id = findArgs("id");
            }
            if (id == null || id.equals("-")) {
                return "-";
            }
            Country country = countryMap.get(id);
            if (country != null) {
                return country.getCountryname();
            }
            return id;

        } else if (type.equals("GUIDE")) {
            String id = findArgs("guideid");
            if (id == null || id.equals("null")) {
                return "-";
            }
            Guide guide = guideMap.get(id);
            if (guide != null) {
                return guide.getName();
            }
            return id;
        }
        return "-";
    }
    
    /**
     * 获取城市id
     *
     * @return
     */
    public String getCityId(){
    	 String id = findArgs("city_id");
         if (id.equals("-")) {
             id = findArgs("cityid");
         }
         if (id == null || id.equals("-")) {
             return "-";
         }
         return id;
    }
    
    /**
     * 获取国家id
     *
     * @return
     */
    public String getCountryId(){
    	 String id = findArgs("country_id");
         if (id.equals("-")) {
             id = findArgs("countryid");
         }
         if (id.equals("-")) {
             id = findArgs("id");
         }
         if (id == null || id.equals("-")) {
             return "-";
         }
         return id;
    }
    
//    @Override
//	public ObjectInspector initialize(ObjectInspector[] arguments)
//			throws UDFArgumentException {
//    	if (arguments.length != 2) {
//            throw new UDFArgumentLengthException(
//                    "para error");
//        }
//
//        converters = new ObjectInspectorConverters.Converter[arguments.length];
//        for (int i = 0; i < arguments.length; i++) {
//            converters[i] = ObjectInspectorConverters
//                    .getConverter(
//                            arguments[i],
//                            PrimitiveObjectInspectorFactory.writableStringObjectInspector);
//        }
//        // 返回map关键在这里
//        return ObjectInspectorFactory.getStandardMapObjectInspector(
//                PrimitiveObjectInspectorFactory.javaStringObjectInspector,
//                PrimitiveObjectInspectorFactory.javaStringObjectInspector);
//	}

//    /**
//     * 根据不同的api接口进行相应的转换
//     * @param api
//     * @param args
//     * @return
//     */
//	@Override
//	public Object evaluate(DeferredObject[] arguments) throws HiveException {
//		// TODO Auto-generated method stub
//		// 这里输入的是ip信息
//        Text api = (Text) converters[0].convert(arguments[0].get());
//        Text args= (Text) converters[1].convert(arguments[1].get());
//        argsStr = String.valueOf(args).replace("\\", "");
//        argsStr = argsStr.replace("//", "/");
//		return apireplace(api.toString(), argsStr);
//	}
//
//	@Override
//	public String getDisplayString(String[] children) {
//		assert (children.length == 2);
//        return "app_trans(" + children[0] + ","+children[1]+")";
//	}
    
//    public Object evaluate(String api, String args) {
//        argsStr = args.replace("\\", "");
//        argsStr = args.replace("//", "/");
//
//        String source = findArgs("source");
//        if (source == null) {
//            source = "";
//        }
//
//        Map<String,String> result=apireplace(api, args);
//        return result;
//    }

    /**
     * 从参数字符串中查找对应key的值
     * @param key
     * @return
     */
    public String findArgs(String key) {
        Pattern p = Pattern.compile("(s:[0-9]+:\"" + key + "\";)");
        Matcher m = p.matcher(argsStr);
        if (m.find()) {
            int idx = m.start();
            String s = m.group();
            p = Pattern.compile("(s:[0-9]+:\"(.*?)\";)");
            m = p.matcher(argsStr.substring(idx + s.length()));
            if (m.find()) {
                s = m.group();
                s = s.substring(s.indexOf("\"")+1, s.length()-2);
                return s;
            }
        }
        return "-";
    }

    /**
     * api转换
     * @param api
     * @param args
     * @return
     */
    public Map<String,String> apireplace(String api, String args , Map<String , String>mapApp , Map<String ,City> cityMap ,  Map<String ,Country> countryMap ,  Map<String ,Guide> guideMap) {
    	if(api==null||args==null||"".equals(api.trim())||"".equals(args.trim())){
    		return null ; 
    	}
    	
    	argsStr = String.valueOf(args).replace("\\", "");
    	argsStr = argsStr.replace("//", "/");
    	
    	Map<String,String> data_result = new HashMap<String ,String>();
    	String api_path="/open"+api;
    	String channel="-";
    	String ugc_type="-";
    	String ugc_content="-";
    	//argsStr=args;
    	
    	if(api.equals("/lastminute/get_lastminute_list")){
    		String type="all";//二级分类
    		String country_id=getCountryId();//目的地 默认为0
    		String product_type=findArgs("product_type");//折扣类型 默认为0
    		String departure=findArgs("departure");//出发地 默认为“”
    		String times=findArgs("times");//出发时间 默认为“”
    		String continent_id=findArgs("continent_id");//大洲 默认为0
    		String city_id="0";//城市id
    		if (country_id.equals("0")&&product_type.equals("0")&&departure.equals("")&&times.equals("")&&continent_id.equals("0")) {
    			data_result.put("api_path", "z.qyer.com");
    			data_result.put("channel","z");
    			data_result.put("ugc_type","index");
    			data_result.put("ugc_content", "-");
				return data_result;
			}else{
				if(departure.equals("")){
					departure="0";
				}
				if (times.equals("")) {
					times="0";
				}
				data_result.put("api_path", "z.qyer.com/"+product_type+"/"+type+"_"+departure+"_"+times+"_"+continent_id+"_"+country_id+"_"+city_id);
    			data_result.put("channel","z");
    			data_result.put("ugc_type","choose");
    			data_result.put("ugc_content", "-");
				return data_result;
			}
    	}
    	
    	//个人中心
        if (api.equals("/qyer/bbs/thread_list")) {
            String userid = findArgs("user_id");
            if(!userid.equals("-")){
            	 String type = findArgs("type");
                 if (type.equals("post")) {
                	 data_result.put("api_path", "www.qyer.com/u/"+userid+"/travel");
         			 data_result.put("channel","u");
         			 data_result.put("ugc_type","bbs_post");
         			 data_result.put("ugc_content", "-");
                     return data_result;//bbs我发表的帖子
                 } else if (type.equals("fav")) {
                	 data_result.put("api_path", "www.qyer.com/u/"+userid+"/travel");
         			 data_result.put("channel","u");
         			 data_result.put("ugc_type","bbs_fav");
         			 data_result.put("ugc_content", "-");
                     return data_result;//bbs我收藏的帖子
                 }
            }
           
        }else if(api.equals("/plan/get_list")){
        	String userid = findArgs("uid");
        	if(!userid.equals("-")){
        		 data_result.put("api_path", "www.qyer.com/u/"+userid+"/plan");
    			 data_result.put("channel","u");
    			 data_result.put("ugc_type","plan");
    			 data_result.put("ugc_content", "-");
        		return data_result;//我的行程
        	}
        }
        
        //目的地模块
        if (api.equals("/place/common/get_recommend_plan_list")) {
            String type = findArgs("type");
            if (type.equals("country")) {
            	data_result.put("api_path", "place.qyer.com/" + getNameByType("COUNTRY" , cityMap ,   countryMap , guideMap) + "/plan");
   			 	data_result.put("channel","place");
   			 	data_result.put("ugc_type","country_plan");
   			 	data_result.put("ugc_content", getCountryId());
                return data_result;//目的地国家行程推荐
            } else if (type.equals("city")) {
            	data_result.put("api_path", "place.qyer.com/" + getNameByType("CITY", cityMap ,   countryMap , guideMap) + "/plan");
   			 	data_result.put("channel","place");
   			 	data_result.put("ugc_type","city_plan");
   			 	data_result.put("ugc_content", getCityId());
                return data_result;//目的地城市行程推荐
            }
        } else if (api.equals("/place/common/get_essence_bbs_list")) {
            String type = findArgs("type");
            if (type.equals("country")) {
            	data_result.put("api_path", "place.qyer.com/" + getNameByType("COUNTRY", cityMap ,   countryMap , guideMap) + "/travel-notes");
   			 	data_result.put("channel","place");
   			 	data_result.put("ugc_type","country_travel-notes");
   			 	data_result.put("ugc_content", getCountryId());
                return data_result;//获取目的地国家推荐游记列表
            } else if (type.equals("city")) {
            	data_result.put("api_path", "place.qyer.com/" + getNameByType("CITY", cityMap ,   countryMap , guideMap) + "/travel-notes");
   			 	data_result.put("channel","place");
   			 	data_result.put("ugc_type","city_travel-notes");
   			 	data_result.put("ugc_content", getCityId());
                return data_result;//获取目的地城市推荐游记列表
            }
        } else if (api.equals("/place/poi/get_poi_list")) { //根据poi分类获取城市下poi列表
            String categoryid = findArgs("categoryid");
            String city = getNameByType("CITY", cityMap ,   countryMap , guideMap);
            String category = category(categoryid);
            data_result.put("api_path", "place.qyer.com/" + city + category);
			data_result.put("channel","place");
			data_result.put("ugc_type","poi_list");
			data_result.put("ugc_content", getCityId());
            return data_result;
        }
        
        //锦囊模块
        if (api.equals("/guide/guide/get_guide_list")||api.equals("/qyer/guide/list")) {
            String type = findArgs("type");
            if (type.equals("country")) {
            	data_result.put("api_path", "guide.qyer.com/" + getNameByType("COUNTRY", cityMap ,   countryMap , guideMap));
    			data_result.put("channel","guide");
    			data_result.put("ugc_type","country");
    			data_result.put("ugc_content",findArgs("objectid"));
                return  data_result;//国家锦囊
            } else if (type.equals("city")) {
            	data_result.put("api_path", "guide.qyer.com/" + getNameByType("CITY", cityMap ,   countryMap , guideMap));
    			data_result.put("channel","guide");
    			data_result.put("ugc_type","city");
    			data_result.put("ugc_content",findArgs("objectid"));
                return  data_result;//城市锦囊
            }
        }
        
        //poi模块
        if(api.equals("/qyer/onroad/poi_list")){
        	String category_id=findArgs("category_id");
        	String type="-";
        	if(!category_id.equals("-")){
        		if(category_id.equals("32")){//景点
            		type="sight";
            	}else if(category_id.equals("78")){//美食
            		type="food";
            	}else if(category_id.equals("147")){//购物
            		type="shopping";
            	}else if(category_id.equals("148")){//活动
            		type="activity";
            	}
        		data_result.put("api_path", "place.qyer.com/"+getNameByType("CITY", cityMap ,   countryMap , guideMap)+"/"+type);
    			data_result.put("channel","place");
    			data_result.put("ugc_type","poi_category");
    			data_result.put("ugc_content",getCityId());
        		return data_result;//获取poi等信息
        	}

        }
        
        if(api.equals("/qyer/ask/question/search_list")){
        	String area_name=findArgs("area_name");
        	String keyword=findArgs("keyword");
        	if(!keyword.equals("-")){
        		data_result.put("ugc_content",keyword);
        		data_result.put("api_path", "ask.qyer.com/search?q="+keyword);
        		data_result.put("ugc_type","search");
        	}else{
        		data_result.put("ugc_content",area_name);
        		data_result.put("api_path", "ask.qyer.com/search?q="+area_name);
        		data_result.put("ugc_type","area");
        	}
			data_result.put("channel","ask");
			
			return data_result;

        }
        
        if (mapApp.size() > 0) {
        	String app_array_list=mapApp.get(api);
        	if(null!=app_array_list&&!app_array_list.equals("")){
        		String[] app_array = app_array_list.split("##");
    			if (app_array.length > 6) {
    				String app_p=app_array[0];//app_name的path
    				String app_url=app_array[1];//转换后的url
    				String app_is_param=app_array[2];//判断是否有参数值 -.没有 0.参数值为获取id的名称 1.为id
    				String app_param=app_array[3];//参数
    				String app_channel=app_array[4];//获取channel
    				String app_type=app_array[5];//获取ugc_type
    				String app_content=app_array[6];//获取ugc content
    				
    				api_path=app_url;
    				channel=app_channel;
    				ugc_type=app_type;
    				if(("city_id").equals(app_content)||("cityid").equals(app_content)){
    					ugc_content=getCityId();
    				}else if(("country_id").equals(app_content)||("countryid").equals(app_content)){
    					ugc_content=getCountryId();
    				}else{
    					ugc_content=findArgs(app_content);
    				}
    				
    				if(app_is_param.equals("0")){
    					api_path=app_url.replace("*", getNameByType(app_param, cityMap ,   countryMap , guideMap));
    				}else if(app_is_param.equals("1")){
    					api_path=app_url.replace("*", findArgs(app_param));
    				}
    			}
        	}
        }
        data_result.put("api_path", api_path);
		data_result.put("channel",channel);
		data_result.put("ugc_type",ugc_type);
		data_result.put("ugc_content",ugc_content);
        
        return data_result;
    }



    /**
     * POI类别对应关系
     * @param id
     * @return
     */
    public String category(String id) {
        if (id.equals("0")) {
            return "/poi";
        } else if (id.equals("32")) {
            return "/poi/sight";
        } else if (id.equals("77")) {
            return "/poi/traffic";
        } else if (id.equals("78")) {
            return "/poi/food";
        } else if (id.equals("147")) {
            return "/poi/shopping";
        } else if (id.equals("148")) {
            return "/poi/activity";
        } else if (id.equals("149")) {
            return "/poi/hotel";
        } else if (id.equals("150")) {
            return "/poi/tips";
        } else if (id.equals("151")) {
            return "/poi/path";
        }
        return "";
    }


    


    public static void main(String[] args) {
        
//        AppUgcUtil p = new AppUgcUtil();
//        System.out.println(p.apireplace("/lastminute/get_detail", "a:14:{s:6:\"action\";s:10:\"get_detail\";s:15:\"app_installtime\";s:10:\"1431667154\";s:5:\"count\";s:2:\"20\";s:2:\"id\";s:5:\"42283\";s:4:\"page\";s:1:\"1\";s:6:\"source\";s:24:\"LastMinuteViewController\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.1052252404.1429873433.1431667255.1431877317.4\";s:6:\"__utmb\";s:26:\"253397513.19.10.1431877317\";s:6:\"__utmc\";s:9:\"253397513\";s:6:\"__utmt\";s:1:\"1\";s:6:\"__utmz\";s:70:\"253397513.1429873433.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"69fb8448-a38a-cc26-a765-7652ee57d3c2\";s:8:\"_session\";s:13:\"1431877317300\";}"));
//        System.out.println(p.apireplace("/qyer/footprint/poi_detail","a:13:{s:6:\"action\";s:10:\"poi_detail\";s:15:\"app_installtime\";s:10:\"1431154163\";s:5:\"count\";s:2:\"20\";s:4:\"page\";s:1:\"1\";s:6:\"poi_id\";s:6:\"109098\";s:10:\"screensize\";s:4:\"1242\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.705435190.1416399238.1431876049.1431878566.26\";s:6:\"__utmb\";s:25:\"253397513.3.10.1431878566\";s:6:\"__utmc\";s:9:\"253397513\";s:6:\"__utmz\";s:70:\"253397513.1416399238.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"620b2e79-f062-1894-963e-5cf3704d9672\";s:8:\"_session\";s:13:\"1431878565619\";}"));
//        System.out.println(p.apireplace("/app/time"," a:10:{s:6:\"action\";s:4:\"time\";s:15:\"app_installtime\";s:10:\"1431442505\";s:5:\"count\";s:2:\"20\";s:4:\"page\";s:1:\"1\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.1559974740.1422410615.1422777057.1430186465.3\";s:6:\"__utmz\";s:70:\"253397513.1422410615.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"f03dcf57-1c72-6862-9dc1-d453c3b3beb3\";s:8:\"cdb_auth\";s:51:\"8cbcBFgTGZSKJfvIYXfZ+Z0MurnABntuKNR65Ok97cES40Z+agM\";s:14:\"cdb_cookietime\";s:8:\"31536000\";}"));
//        System.out.println(p.apireplace("/qyer/guide/list","a:10:{s:6:\"action\";s:4:\"list\";s:15:\"app_installtime\";s:10:\"1431155295\";s:5:\"count\";s:2:\"20\";s:8:\"objectid\";s:4:\"7031\";s:4:\"page\";s:1:\"1\";s:4:\"type\";s:4:\"city\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.1072685975.1428587452.1428587452.1428587452.1\";s:6:\"__utmz\";s:70:\"253397513.1428587452.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"f32930d3-f262-da46-2371-4b00ff86b07b\";}"));
//        System.out.println(p.apireplace("/qyer/search/index","a:11:{s:6:\"action\";s:5:\"index\";s:15:\"app_installtime\";s:10:\"1431649815\";s:5:\"count\";s:2:\"20\";s:7:\"keyword\";s:6:\"希腊\";s:4:\"page\";s:1:\"1\";s:11:\"place_field\";s:16:\"country|city|poi\";s:4:\"type\";s:5:\"place\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.1155226423.1429761946.1429761946.1429761946.1\";s:6:\"__utmz\";s:70:\"253397513.1429761946.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"c1ddeb67-17b8-12de-ef5f-40db27470eab\";}"));
//        System.out.println(p.apireplace("/lastminute/app_get_lastminute_list","a:14:{s:6:\"action\";s:23:\"app_get_lastminute_list\";s:10:\"orderValue\";s:0:\"\";s:12:\"continent_id\";s:1:\"0\";s:9:\"orderName\";s:0:\"\";s:5:\"times\";s:0:\"\";s:12:\"product_type\";s:1:\"0\";s:15:\"app_installtime\";s:10:\"1414329256\";s:10:\"country_id\";s:1:\"0\";s:6:\"__utma\";s:56:\"253397513.964470677.1414409615.1431479040.1431531872.167\";s:6:\"__utmz\";s:70:\"253397513.1414409615.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"fd678f47-c98d-81a3-88bf-9a3e9503f576\";s:8:\"cdb_auth\";s:51:\"24e2F47Piq44yYj1ERwDdMEORQ1tXqeRCqbdlVDIk9l+n5dnmtc\";s:14:\"cdb_cookietime\";s:8:\"31536000\";s:15:\"QYER_USER_LOGIN\";s:20:\"Y0lXS3V0DjsDCEJTcVcC\";}"));
//        System.out.println(p.apireplace("/lastminute/get_lastminute_list","a:17:{s:6:\"action\";s:19:\"get_lastminute_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:12:\"continent_id\";s:1:\"0\";s:5:\"count\";s:2:\"20\";s:10:\"country_id\";s:1:\"0\";s:9:\"departure\";s:0:\"\";s:11:\"is_show_pay\";s:1:\"1\";s:6:\"max_id\";s:1:\"0\";s:4:\"page\";s:1:\"1\";s:9:\"page_size\";s:2:\"20\";s:12:\"product_type\";s:1:\"0\";s:5:\"times\";s:0:\"\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"vh_ids_n\";s:23:\"[\"446553_9\",\"270168_9\"]\";}"));
//        System.out.println(p.apireplace("/lastminute/get_lastminute_list","a:17:{s:6:\"action\";s:19:\"get_lastminute_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:12:\"continent_id\";s:1:\"0\";s:5:\"count\";s:2:\"20\";s:10:\"country_id\";s:1:\"0\";s:9:\"departure\";s:0:\"\";s:11:\"is_show_pay\";s:1:\"1\";s:6:\"max_id\";s:1:\"0\";s:4:\"page\";s:1:\"1\";s:9:\"page_size\";s:2:\"20\";s:12:\"product_type\";s:4:\"1017\";s:5:\"times\";s:0:\"\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"vh_ids_n\";s:23:\"[\"446553_9\",\"270168_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/hotel/search_list","a:14:{s:6:\"action\";s:11:\"search_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:7:\"checkin\";s:9:\"2015-5-21\";s:8:\"checkout\";s:9:\"2015-5-22\";s:7:\"city_id\";s:2:\"20\";s:5:\"count\";s:2:\"20\";s:8:\"from_key\";s:20:\"app_ios_index_search\";s:7:\"orderby\";s:1:\"1\";s:4:\"page\";s:1:\"1\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"vh_ids_n\";s:23:\"[\"446553_9\",\"270168_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/bbs/forum_thread_list","a:12:{s:6:\"action\";s:17:\"forum_thread_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:5:\"count\";s:2:\"20\";s:8:\"delcache\";s:1:\"1\";s:8:\"forum_id\";s:2:\"53\";s:4:\"page\";s:1:\"1\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"_session\";s:13:\"1432102224317\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/onroad/poi_list","a:14:{s:6:\"action\";s:8:\"poi_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:11:\"category_id\";s:2:\"78\";s:7:\"city_id\";s:2:\"55\";s:5:\"count\";s:2:\"20\";s:7:\"orderby\";s:7:\"popular\";s:4:\"page\";s:1:\"1\";s:5:\"types\";s:0:\"\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"_session\";s:13:\"1432104958389\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/bbs/forum_thread_list","a:11:{s:6:\"action\";s:17:\"forum_thread_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:5:\"count\";s:2:\"20\";s:8:\"delcache\";s:1:\"1\";s:8:\"forum_id\";s:2:\"12\";s:4:\"page\";s:1:\"1\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/bbs/thread_fav_status","a:12:{s:6:\"action\";s:17:\"thread_fav_status\";s:15:\"app_installtime\";s:10:\"1431337773\";s:5:\"count\";s:2:\"20\";s:4:\"page\";s:1:\"1\";s:6:\"source\";s:4:\"form\";s:3:\"tid\";s:7:\"1109343\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1430703938.1431399646.5\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"_session\";s:13:\"1432106887005\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/footprint/gone_city_list","a:11:{s:6:\"action\";s:14:\"gone_city_list\";s:15:\"app_installtime\";s:10:\"1431337773\";s:5:\"count\";s:2:\"20\";s:10:\"country_id\";s:3:\"215\";s:4:\"page\";s:1:\"1\";s:7:\"user_id\";s:7:\"5249293\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1431399646.1432107755.6\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/lastminute/get_detail","a:15:{s:6:\"action\";s:10:\"get_detail\";s:15:\"app_installtime\";s:10:\"1431337773\";s:5:\"count\";s:2:\"20\";s:2:\"id\";s:5:\"42867\";s:4:\"page\";s:1:\"1\";s:6:\"source\";s:24:\"LastMinuteViewController\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:54:\"253397513.433074947.1428201042.1432107755.1432193717.7\";s:6:\"__utmb\";s:25:\"253397513.1.10.1432193717\";s:6:\"__utmc\";s:9:\"253397513\";s:6:\"__utmt\";s:1:\"1\";s:6:\"__utmz\";s:70:\"253397513.1428201042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"911bfff3-7f97-f286-dc89-9b5572443086\";s:8:\"_session\";s:13:\"1432193718456\";s:8:\"vh_ids_n\";s:34:\"[\"446553_9\",\"270168_9\",\"371033_9\"]\";}"));
//        System.out.println(p.apireplace("/qyer/guide/detail","a:4:{s:6:\"action\";s:6:\"detail\";s:1:\"v\";s:1:\"1\";s:15:\"app_installtime\";s:13:\"1432565533595\";s:2:\"id\";s:2:\"41\";}"));
//        System.out.println(p.apireplace("/qyer/footprint/country_detail","a:9:{s:6:\"action\";s:14:\"country_detail\";s:15:\"app_installtime\";s:10:\"1431338436\";s:5:\"count\";s:2:\"20\";s:10:\"country_id\";s:3:\"219\";s:4:\"page\";s:1:\"1\";s:1:\"v\";s:1:\"1\";s:6:\"__utma\";s:55:\"253397513.1581128090.1423581827.1423581827.1423629585.2\";s:6:\"__utmz\";s:70:\"253397513.1423581827.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\";s:5:\"_guid\";s:36:\"c55175ad-f694-bf74-f407-1a4604ac9b47\";}"));
//        System.out.println(p.apireplace("/qyer/user/profile","a:4:{s:6:\"action\";s:7:\"profile\";s:1:\"v\";s:1:\"1\";s:15:\"app_installtime\";s:13:\"1388381599994\";s:7:\"user_id\";s:7:\"2409214\";}"));
//        System.out.println(p.apireplace("/lastminute/app_lastminute_list"," a:11:{s:1:\"v\";s:1:\"1\";s:15:\"app_installtime\";s:13:\"1439336540797\";s:9:\"page_size\";s:2:\"10\";s:4:\"page\";s:1:\"7\";s:12:\"product_type\";s:1:\"0\";s:12:\"continent_id\";s:2:\"10\";s:10:\"country_id\";s:2:\"14\";s:9:\"departure\";s:4:\"bjtj\";s:9:\"orderName\";s:11:\"s0|r1|s2|i3\";s:10:\"orderValue\";s:23:\"3299|0|1440732189|52715\";s:8:\"sequence\";s:8:\"priceAsc\";}"));
      
    }
}
